1. Field of Invention
The present invention is related to a digital to analog converter and method thereof, and more particularly, to a digital to analog converter and method thereof for outputting an output voltage at a desired voltage level precisely.
2. Description of Related Art
The digital to analog converter (DAC) is widely used in current digital circuits. Most microcontrollers have a DAC to perform the digital to analog conversion operation. Please refer to FIG. 1, which is a circuit diagram of a DAC 10 according to the prior art. The DAC 10 has a negative feedback regulator 12, a ladder circuit 16, and a reference resistor RREF. The negative feedback regulator 12 has an operational amplifier 14. The operational amplifier 14 has a positive input terminal coupled to a reference voltage VREF, a negative input terminal coupled to an end of the ladder circuit 16, and an output terminal for outputting an output voltage VOUT. The ladder circuit 16 has a plurality of transistor-resistor units A0-AN, where N is a positive integer. Each of the transistor-resistor units A0-AN has a transistor and a resistor coupled to the transistor in series. For example, the transistor-resistor units A0 has a transistor M0 and a resistor R0, and the transistor M0 is coupled to the resistor R0 in series. Additionally, except the resistor R0 of the transistor-resistor unit A0, the resistance of the resistor R1-RN of each of the transistor-resistor units A1-AN is 2i times of that of the resistor R0, where i is a positive integer. For example, R1=21×R0, RN=2N×R0, etc. The gates of the transistors M0-MN are biased by control voltages that are associated with digital codes B0 to BN. For each of the control voltages, the control voltage is high while the associated digital code is “1”, and the control voltage is low while the associated digital code is “0”. For example, when the digital code B0  is “1”, the gate of the transistor M0 is biased by a high-level control voltage, such that the transistor M0 is turned on. When the digital code B0 is “0”, the gate of the transistor M0 is biased by a low-level control voltage, such that the transistor M0 is turned off. Therefore, each of the digital codes B0 to BN is used to turn on/off a corresponding one of the transistors M0-MN, and the output voltage VOUT could be determined as:
                              V          OUT                =                                            [                                                                                                                                            R                          ON                                                ×                                                  (                                                                                                                    B                                0                                                            _                                                        +                                                                                          B                                1                                                            _                                                        +                            …                            +                                                                                          B                                N                                                            _                                                                                )                                                                    +                                                                                                                                  (                                                                                                    R                            0                                                    ⁢                                                      B                            0                                                                          +                                                                              R                            1                                                    ⁢                                                      B                            1                                                                          +                        …                        +                                                                              R                            N                                                    ⁢                                                      B                            N                                                                                              )                                                                                  ]                        ×                                          V                REF                                            R                REF                                              +                      V            REF                                              (        1        )                                                          ⁢                  =                                                    [                                                                                                                                                          R                            ON                                                    ×                                                      (                                                                                                                            B                                  0                                                                _                                                            +                                                                                                B                                  1                                                                _                                                            +                              …                              +                                                                                                B                                  N                                                                _                                                                                      )                                                                          +                                                                                                                                                (                                                                                                                                                                                                                                                        2                                      ⁢                                                                                                                                                                                            0                                                                    ⁢                                                                      R                                    0                                                                    ⁢                                                                      B                                    0                                                                                                  +                                                                                                                                                                                                                                                                                                                    2                                      ⁢                                                                                                                                                                                            1                                                                    ⁢                                                                      R                                    0                                                                    ⁢                                                                      B                                    1                                                                                                  +                                …                                +                                                                                                      2                                    N                                                                    ⁢                                                                      R                                    0                                                                    ⁢                                                                      B                                    N                                                                                                                                                                                                      )                                                                                            ]                            ×                                                V                  REF                                                  R                  REF                                                      +                          V              REF                                                          (        2        )            where RON represents the resistance of each turned-on transistor M0-MN, and each of B0 to BN represents an digital code that is complementary to a corresponding one of the digital codes B0 to BN. For example, B0 and B0 are complementary to each other; B1 and B1 are complementary to each other; and BN and BN are complementary to each other.
Each of combinations of the digital codes B0 to BN is used to determine a corresponding voltage level of the output voltage VOUT. In this case, it is assumed that a resistance RM is described as follows:RM=RON×( B0+ B1+. . . + BN)  (3)
Therefore, the above equation (2) could be written as:
                              V          OUT                =                                            [                                                R                  M                                +                                  (                                                                                                                                                                                                        2                                ⁢                                                                                                                                                              0                                                        ⁢                                                          R                              0                                                        ⁢                                                          B                              0                                                                                +                                                                                                                                                                                                                                                        2                                ⁢                                                                                                                                                              1                                                        ⁢                                                          R                              0                                                        ⁢                                                          B                              1                                                                                +                          …                          +                                                                                    2                              N                                                        ⁢                                                          R                              0                                                        ⁢                                                          B                              N                                                                                                                                                            )                                            ]                        ×                                          V                REF                                            R                REF                                              +                      V            REF                                              (        4        )                                                          ⁢                  =                                                    (                                                                                                                                                                                        2                              ⁢                                                                                                                                                    0                                                    ⁢                                                      R                            0                                                    ⁢                                                      B                            0                                                                          +                                                                                                                                                                                                                                    2                              ⁢                                                                                                                                                    1                                                    ⁢                                                      R                            0                                                    ⁢                                                      B                            1                                                                          +                        …                        +                                                                              2                            N                                                    ⁢                                                      R                            0                                                    ⁢                                                      B                            N                                                                                                                                              )                            ×                                                V                  REF                                                  R                  REF                                                      +                                          (                                  1                  +                                                            R                      M                                                              R                      REF                                                                      )                            ⁢                              V                REF                                                                        (        5        )            
Generally, in order to output the output voltage VOUT at a desired level more precisely, it is desired that the value of
  (            (              1        +                              R            M                                R            REF                              )        ×          V      REF        )is a constant. However, according to the equation (3), the resistance RM varies with the digital codes B0 to BN, such that it is difficult to precisely output the output voltage VOUT at a desired level.